home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / Draw / Sources / Content.h < prev    next >
Encoding:
Text File  |  1996-12-16  |  5.4 KB  |  181 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Content.h
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef CONTENT_H
  11. #define CONTENT_H
  12.  
  13. // ----- FrameWork Includes -----
  14.  
  15. #ifndef FWCONTNT_H
  16. #include "FWContnt.h"
  17. #endif
  18.  
  19. #ifndef FWSCPTBL_H
  20. #include "FWScptbl.h"
  21. #endif
  22.  
  23. #ifndef BASESHP_H
  24. #include "BaseShp.h"
  25. #endif
  26.  
  27. //========================================================================================
  28. //    Forward Declarations
  29. //========================================================================================
  30.  
  31. class CDrawPart;
  32. class CProxyShape;
  33.  
  34. //========================================================================================
  35. //    class CDrawContent
  36. //========================================================================================
  37.  
  38. class CDrawContent : public FW_CContent
  39. {
  40. public:
  41.     friend class CDrawContentShapeIterator;
  42.     friend class CSemanticShapeElementIterator;
  43.     friend class CAllShapeIterator;
  44.     
  45. //----------------------------------------------------------------------------------------
  46. //    Initialization/Destruction
  47. //
  48.   public:
  49.     FW_DECLARE_AUTO(CDrawContent)
  50.     
  51.     CDrawContent(Environment* ev, CDrawPart* part, const FW_CRect& contentRect);
  52.     CDrawContent(Environment* ev, CDrawPart* part, CDrawContent* other);
  53.  
  54.     virtual ~CDrawContent();
  55.  
  56. //----------------------------------------------------------------------------------------
  57. //    Inherited API
  58. //
  59.   public:
  60.     virtual FW_MProxy*    IsDataOnlyOneProxy(Environment* ev) const;
  61.  
  62.     virtual void        ExternalizeKind(Environment* ev,
  63.                             ODStorageUnit* storageUnit,
  64.                             FW_CKind* kind,
  65.                             FW_StorageKinds storageKind,
  66.                             FW_CPromise* promise,
  67.                             FW_CCloneInfo* cloneInfo);
  68.     virtual FW_Boolean    InternalizeKind(Environment* ev,
  69.                             ODStorageUnit* storageUnit, 
  70.                             FW_CKind* kind,
  71.                             FW_StorageKinds storageKind,
  72.                             FW_CCloneInfo* cloneInfo);
  73.                             
  74. //----------------------------------------------------------------------------------------
  75. //    Overridable API
  76. //
  77.   public:
  78.     virtual FW_Boolean    IsOKtoWrite(Environment* ev, CBaseShape* shape);
  79.     virtual void        PostInternalizeShape(Environment* ev, const FW_CPoint& offset, CBaseShape* shape, short index);
  80.  
  81. //----------------------------------------------------------------------------------------
  82. //    New API
  83. //
  84.   public:
  85.     CProxyShape*        AddSingleEmbeddedFrame(Environment* ev,
  86.                                         FW_CEmbeddingFrame* scopeFrame,
  87.                                         ODPart* odEmbeddedPart, 
  88.                                         ODFrame* odEmbeddedFrame,
  89.                                         ODShape* suggestedShape,
  90.                                         ODTypeToken viewType);
  91.  
  92.  
  93.     void                AddShape(Environment* ev, CBaseShape* shape, CBaseShape* nextShape=NULL);
  94.     void                RemoveShape(Environment* ev, CBaseShape* shape);
  95.     void                RemoveShapeFromContent(Environment* ev, CBaseShape* shape);
  96.  
  97.     void                EmptyShapes(Environment* ev);
  98.  
  99.     ODShape*            CalcUpdateShape(Environment* ev);
  100.     void                OffsetShapes(Environment* ev, const FW_CPoint& offset);
  101.     void                RedrawShapes(Environment* ev);
  102.     void                RedrawShape(Environment* ev, CBaseShape* shape);
  103.     void                RedrawShape(Environment* ev, ODShape* odShape);
  104.  
  105. protected:
  106.     void                ExternalizeShapeList(Environment* ev,
  107.                                         ODStorageUnit* storageUnit, 
  108.                                         FW_CCloneInfo* cloneInfo,
  109.                                         FW_Fixed offsetX,
  110.                                         FW_Fixed offsetY);
  111.     void                InternalizeShapeList(Environment* ev,
  112.                                             ODStorageUnit* storageUnit, 
  113.                                             FW_CCloneInfo* cloneInfo);
  114.  
  115. //----------------------------------------------------------------------------------------
  116. //    Getters & Setters
  117. //
  118.   public:
  119.     unsigned long        CountShapes() const;
  120.     FW_Boolean            IsEmpty() const;
  121.  
  122.     CBaseShape*            GetFirstShape() const;
  123.     CBaseShape*            GetShapeAfter(CBaseShape* shape) const;
  124.  
  125.     unsigned short        GetProxyShapeCount() const
  126.                             {return fProxyShapeCount;}
  127.     
  128.     
  129. //----------------------------------------------------------------------------------------
  130. //    Data Members
  131. //
  132.   protected:
  133.     CShapeCollection*    fShapeList;    // list of CBaseShape*
  134.     CDrawPart*            fDrawPart;
  135.     unsigned short         fProxyShapeCount;
  136.     FW_CRect            fContentRect;
  137. };
  138.  
  139. //========================================================================================
  140. //    class CDrawContentShapeIterator
  141. //========================================================================================
  142.  
  143. class CDrawContentShapeIterator : public CShapeCollectionIterator
  144. {
  145. public:
  146.     FW_DECLARE_AUTO(CDrawContentShapeIterator)
  147.  
  148. public:
  149.     CDrawContentShapeIterator(CDrawContent* content);
  150.     ~CDrawContentShapeIterator();
  151. };
  152.  
  153. //========================================================================================
  154. //    class CSemanticShapeElementIterator
  155. //========================================================================================
  156.  
  157. class CSemanticShapeElementIterator : public FW_CElementIterator
  158. {
  159. public:
  160.     FW_DECLARE_AUTO(CSemanticShapeElementIterator)
  161.     
  162.     CSemanticShapeElementIterator(CDrawContent* content, ODDescType desiredClass);
  163.     ~CSemanticShapeElementIterator();
  164.  
  165. private:
  166.     CSemanticShapeElementIterator(const CSemanticShapeElementIterator& other);
  167.     
  168. public:
  169.     virtual FW_MScriptable* First();
  170.     virtual FW_MScriptable* Next();
  171.     virtual Boolean IsNotComplete()    { return fImplementation.IsNotComplete(); }
  172.     
  173.     Boolean IsDesiredClass(FW_MScriptable* element) const;
  174.     
  175. private:
  176.     CShapeCollectionIterator     fImplementation;
  177.     ODDescType                    fDesiredClass;
  178. };
  179.  
  180. #endif
  181.